home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 18 / 018.d81 / comal #11 < prev    next >
Text File  |  2022-08-26  |  6KB  |  301 lines

  1.  
  2.          COMAL CORNER #11
  3.          ===== ====== ===
  4.  
  5.     written by:  Joel Ellis Rea
  6.  
  7.  
  8.    I think I have finally figured out
  9.  
  10. why COMAL is such an easy language to
  11.  
  12. learn and use.  Some languages (like
  13.  
  14. BASIC) are easy to learn but not easy
  15.  
  16. to use.  Aside from the lack of access
  17.  
  18. to such C64 features as graphics, the
  19.  
  20. SID sound chip and sprites, the BASIC
  21.  
  22. language itself is just plain hard to
  23.  
  24. use.  How many times have you looked
  25.  
  26. at a BASIC program listing that began
  27.  
  28. with something like:
  29.  
  30.    10 GOSUB 1000
  31.    20 GOSUB 10000:ON C GOSUB 12000,
  32.    12500,11000:IF C<4 THEN 10
  33.  
  34.  
  35.    Sure, you may know what that line
  36.  
  37. means, but what does it DO?  If that
  38.  
  39. is a program of any real size (say, 3
  40.  
  41. or more printer pages), you could have
  42.  
  43. a real headache by the time you trace
  44.  
  45. through the GOSUBs and get to the ON
  46.  
  47. GOTO!
  48.  
  49.  
  50.    In COMAL, on the other hand, the
  51.  
  52. above line might be coded:
  53.  
  54.  
  55.    0010 set'up
  56.    0020 REPEAT
  57.    0030  main'menu(choice$)
  58.    0040  CASE choice$ OF
  59.    0050  WHEN "L","l"
  60.    0060   load'sprite'shape
  61.    0070  WHEN "S","s"
  62.    0080   save'sprite'shape
  63.    0090  WHEN "E","e"
  64.    0100   edit'sprite'shape
  65.    0110  OTHERWISE
  66.    0120   NULL
  67.    0130  ENDCASE
  68.    0140 UNTIL choice$ IN "Qq"
  69.  
  70.  
  71.    Sure, it takes more lines, but even
  72.  
  73. though there are no comments, and even
  74.  
  75. though you have seen none of the sub-
  76.  
  77. routines (PROCedures in COMAL talk),
  78.  
  79. I'll bet you have a fair idea of what
  80.  
  81. kind of program those lines are from
  82.  
  83. even if you have never seen a COMAL
  84.  
  85. program before!  In case you were won-
  86.  
  87. dering, yes, that is indeed equivalent
  88.  
  89. to the BASIC lines above.
  90.  
  91.  
  92.    Anyway, my point is that COMAL is
  93.  
  94. indeed "COMmon Algorithmic Language".
  95.  
  96. It, more than Pascal or even Modula-2,
  97.  
  98. is a language whose syntax "flows" the
  99.  
  100. way programmers think.  Want proof?
  101.  
  102. In recent issues of Byte and other
  103.  
  104. magazines not dedicated to any partic-
  105.  
  106. ular system or language, authors and
  107.  
  108. letter writers alike often express
  109.  
  110. algorithms in terms of a "Pseudo-Code"
  111.  
  112. or "Program-Design Language" (PDL),
  113.  
  114. which is not a programming language
  115.  
  116. per se, but a way for programmers to
  117.  
  118. express algorithms on paper.  Indeed,
  119.  
  120. "pseudo-coding" is an important step,
  121.  
  122. right after flowcharting, in profes-
  123.  
  124. sional program design.  Many program-
  125.  
  126. mers who program in Pascal, etc., lay
  127.  
  128. out their logic in PDL before writing
  129.  
  130. a single line of Pascal.
  131.  
  132.  
  133.    Are you wondering what in the world
  134.  
  135. all this has to do with COMAL?  Well,
  136.  
  137. PDL varies from person to person, but
  138.  
  139. the excerpts I have seen in articles
  140.  
  141. and letters are good examples of COMAL
  142.  
  143. syntax (except for minor variances,
  144.  
  145. such as how comments are delimited),
  146.  
  147. EVEN THOUGH THE AUTHOR HAS NEVER SEEN
  148.  
  149. OR HEARD OF COMAL!!!  In other words,
  150.  
  151. COMAL IS PDL!!!  A COMAL programmer
  152.  
  153. need not use a PDL step, he can lay
  154.  
  155. out his structure right on the screen,
  156.  
  157. then build the necessary blocks (PROC-
  158.  
  159. edures and FUNCtions) around it.  Now
  160.  
  161. I know why Borge Christensen called it
  162.  
  163. "COMMON Algorithmic Language"!
  164.  
  165.  
  166.    Now for this month's features.  In
  167.  
  168. COMAL TUTOR #5 we explore FUNCtions
  169.  
  170. in more detail, and introduce the con-
  171.  
  172. cept of PROCedures, COMAL's answer to
  173.  
  174. GOSUB, and check out PLAYNOTE'S
  175.  
  176. summaries of meetings of Comal users
  177.  
  178. on PlayNet. We have our first outside
  179.  
  180. COMAL Corner submission -- a set of
  181.  
  182. two very useful FUNCtions and one
  183.  
  184. very useful PROCedure (which can be
  185.  
  186. used in any version of COMAL).  The
  187.  
  188. first FUNCtion converts a Gregorian
  189.  
  190. calendar date (month, day, year) into
  191.  
  192. a Julian day (not to be confused with
  193.  
  194. the Julian calendar of Julius Caeser).
  195.  
  196. The second FUNCtion converts a Julian
  197.  
  198. day back into a Gregorian date.  The
  199.  
  200. last PROCedure computes the Arctangent
  201.  
  202. properly adjusted for quadrant
  203.  
  204. positions.  The arguments are the X
  205.  
  206. and Y coordinates of the point.  The
  207.  
  208. RETURNed value is the angle in Radians
  209.  
  210. that a vector to the given point would
  211.  
  212. make with the X-axis. Due to a recent
  213.  
  214. move of our editorial staff, the
  215.  
  216. origin of these routines has escaped
  217.  
  218. us.  Would the rightful author please
  219.  
  220. notify us as soon as possible?
  221.  
  222.    Speaking of which, I want to keep
  223.  
  224. COMAL Corner going for as long as I
  225.  
  226. can.  Your comments through the STAR-
  227.  
  228. LINE help, but the editors of Loadstar
  229.  
  230. want to see more reader participation!
  231.  
  232. We have been going for more than half
  233.  
  234. a year with the Corner, and as of this
  235.  
  236. month we've had a grand total of ONE
  237.  
  238. user-submitted COMAL program or COMAL-
  239.  
  240. interest article!  It's not enough to
  241.  
  242. just say you like COMAL Corner, please
  243.  
  244. write in!
  245.  
  246.  
  247.    Submissions to COMAL Corner may be
  248.  
  249. any of the following:
  250.  
  251.  
  252.  1.  A self-written COMAL program.
  253.  2.  A self-written set of COMAL sub-
  254.        programs (PROCs/FUNCs).
  255.  3.  An article on COMAL or a COMAL-
  256.        related topic.
  257.  4.  A review of a COMAL book or disk.
  258.  5.  A letter commenting on this
  259.        series, showing a useful COMAL
  260.        technique, asking COMAL-rela-
  261.        ted questions, etc.
  262.  6.  Anything else you can think of
  263.        that is in good taste, is not
  264.        copyrighted by another source,
  265.        and in some way relates to
  266.        COMAL.
  267.  
  268.  
  269.    Remember, Loadstar PAYS for user
  270.  
  271. submitted articles and programs that
  272.  
  273. meet our standards!
  274.  
  275.  
  276.    Before I forget, I do have a pro-
  277.  
  278. gram of my own this month.  It is a
  279.  
  280. simulation of the path of a drunkard
  281.  
  282. (a great demonstration of COMAL Turtle
  283.  
  284. Graphics).
  285.  
  286.  
  287.    See you on PlayNET, Thursday nights
  288.  
  289. at 9:30 EDT in the COMAL Room.  If you
  290.  
  291. have a modem, BE THERE!  If you don't
  292.  
  293. have a modem, get one and BE THERE!
  294.  
  295.    If you would like to run COMAL
  296. \oad"comal tutor#5",8
  297. TUTOR now, please press the '\' key.
  298.  
  299.  
  300. ---------< end of article >-----------
  301.